import { configureStore } from '@reduxjs/toolkit'
import postReducer from '../features/posts/postSlice'
import usersSlice from "../features/users/usersSlice";
import notificationsSlice from "../features/notifications/notificationsSlice";
import {apiSlice} from "../features/api/apiSlice";

export default configureStore({
  reducer: {
    posts: postReducer,
    users: usersSlice,
    notifications: notificationsSlice,
    [apiSlice.reducerPath]: apiSlice.reducer
  },
  // middleware用于管理缓存的生命周期和控制是否过期
  middleware: getDefaultMiddleware => getDefaultMiddleware().concat(apiSlice.middleware)
})
